package com.yykj.prescription.server.task;

import com.yykj.prescription.server.service.PrescriptionTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@EnableScheduling
public class ScheduledTask {

    @Scheduled(cron = "0 */1 * * * ?")
    public void execute() {
        prescriptionTaskService.expirePrescriptionTask();
    }

    private PrescriptionTaskService prescriptionTaskService;

    @Autowired
    public void setPrescriptionTaskService(PrescriptionTaskService prescriptionTaskService) {
        this.prescriptionTaskService = prescriptionTaskService;
    }
}
